﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum AdType
{
    MainBanner,
    StartGame,
    NewScene,
    Pause,
    EndGame
}

public class ShowAd : MonoBehaviour
{

    public AdType adType = AdType.MainBanner;
    public bool isEnable = false;
    public bool isDisable = false;
    void Start()
    {

    }


    void Update()
    {

    }

    void OnEnable()
    {
        if (isEnable)
        {
            showAd();
        }
    }

    void OnDisable()
    {
        if (isDisable)
        {
            showAd();
        }
    }

    private void showAd()
    {
        switch (adType)
        {
            case AdType.MainBanner:
                GameAdManager.MainBanner();
                break;
            case AdType.StartGame:
                GameAdManager.StartGame(delegate { });
                break;
            case AdType.NewScene:
                GameAdManager.NewScene();
                break;
            case AdType.Pause:
                GameAdManager.Pause();
                break;
            case AdType.EndGame:
                MonoBehaviour t = FindObjectOfType<MonoBehaviour>();
                GameAdManager.EndGame(t, delegate { });
                break;
            default:
                break;
        }
    }
}
